//
//  ACWIndexVC.m
//  aichewang
//
//  Created by ucs on 16/2/23.
//  Copyright © 2016年 aichewang. All rights reserved.
//

#import "ACWIndexVC.h"
#import "ACWTitleView.h"
#import "ACWBusTicketVC.h"
#import "ACWMetroTicketVC.h"
#import "ACWParkingReservationVC.h"

#import "ACWChargeReservationVC.h"

#define gap 20

@interface ACWIndexVC ()

@property (nonatomic, strong) ACWTitleView *titleView;

@end

@implementation ACWIndexVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.titleView.registeredNum = @"42425";
    self.navigationItem.titleView = self.titleView;
    NSArray *titleArr = @[@"共享车位", @"预约停车", @"预约充电", @"高速公路", @"摇摇开门", @"机场收费站", @"公交买票", @"地铁买票", @"客运买票", @"保险7折", @"保养9折", @"违章处理"];
    
    CGFloat btnHW = (screenW - 3 * gap) / 3;
    
    for (int i = 0; i < 12; i ++) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
        btn.frame = CGRectMake(gap / 2 + (btnHW + gap) * (i % 3), gap / 2 + (btnHW + gap) * (i / 3), btnHW, btnHW);
        btn.layer.borderWidth = 2;
        btn.layer.cornerRadius = btnHW / 5;
        btn.layer.borderColor = borderBlue.CGColor;
        btn.tag = 100 + i;
        [btn setTitle:titleArr[i] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        [self.scrollView addSubview:btn];
    }
    self.scrollView.contentSize = CGSizeMake(screenW, (gap + btnHW) * (12 / 3));
}

- (void)btnClick:(UIButton *)btn {

    switch (btn.tag) {
        case 100:
       
            break;
        case 101:
        {
            ACWParkingReservationVC *parkingReservationVC = [ACWParkingReservationVC new];
            [self pushNavControllerWithoutBottomBar:parkingReservationVC];
        }
            break;
        case 102:
        {
            ACWChargeReservationVC *chargeReservationVC = [ACWChargeReservationVC new];
            [self pushNavControllerWithoutBottomBar:chargeReservationVC];
        }
            break;
        case 103:
            
            break;
        case 104:
            
            break;
        case 105:
            
            break;
        case 106:
        {
            ACWBusTicketVC *busTicketVC = [ACWBusTicketVC new];
            [self pushNavControllerWithoutBottomBar:busTicketVC];
        }
            break;
        case 107:
        {
            ACWMetroTicketVC *metroTicketVC = [ACWMetroTicketVC new];
            [self pushNavControllerWithoutBottomBar:metroTicketVC];
        }
            break;
        case 108:
            
            break;
        case 109:
            
            break;
        case 110:
            
            break;
        case 111:
            
            break;
            
        default:
            break;
    }
}

- (ACWTitleView *)titleView {
    if (!_titleView) {
        _titleView = [ACWTitleView titleView];
    }
    return _titleView;
}

@end
